package cn.madis.ymcc.fallback;


import cn.madis.ymcc.CourseFeignClient;
import cn.madis.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignClientFallbackFactory implements FallbackFactory<CourseFeignClient> {


    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public JSONResult checkUserLearn(Long loginId, Long courseId) {
                throwable.printStackTrace();
                return JSONResult.error("降级gggg");
            }

            @Override
            public JSONResult info(String courseId) {
                throwable.printStackTrace();
                return JSONResult.error("降级gggg");
            }
        };
    }
}
